﻿using ArtheaEngine;
using NLog;

namespace ArtheaServer.Commands
{
    public class LookCommand : Command
    {
        private static readonly Logger log = LogManager.GetCurrentClassLogger();

        public LookCommand() : base("look", "Explorers your current location.")
        {
        }

        #region Overrides of Command

        public override void Execute(Character ch, Argument argument)
        {
            if (ch.Room == null)
            {
                log.Warn("Character ({0}) with no room", ch.Name);
                return;
            }

            ch.WriteLine("~G" + ch.Room.Name);
            ch.WriteLine("~W" + ch.Room.Description);

            foreach (Character npc in ch.Room.Characters)
            {
                if (npc == ch) continue;

                if (npc is NonPlayer)
                    ch.WriteLine("~M{0:LongDescr}~x", npc);
                else
                    ch.WriteLine("~M{0} is here.~x", npc);
            }
        }

        #endregion
    }
}